import 'package:safetymonitor/generated/json/base/json_convert_content.dart';
import 'package:safetymonitor/app/data/entities/application/department_user_entity.dart';
import 'package:safetymonitor/app/data/common/choice_bean.dart';


DepartmentUserEntity $DepartmentUserEntityFromJson(Map<String, dynamic> json) {
  final DepartmentUserEntity departmentUserEntity = DepartmentUserEntity();
  final String? companyCode = jsonConvert.convert<String>(json['companyCode']);
  if (companyCode != null) {
    departmentUserEntity.companyCode = companyCode;
  }
  final String? defaultStatus = jsonConvert.convert<String>(json['defaultStatus']);
  if (defaultStatus != null) {
    departmentUserEntity.defaultStatus = defaultStatus;
  }
  final String? departmentIds = jsonConvert.convert<String>(json['departmentIds']);
  if (departmentIds != null) {
    departmentUserEntity.departmentIds = departmentIds;
  }
  final String? departmentName = jsonConvert.convert<String>(json['departmentName']);
  if (departmentName != null) {
    departmentUserEntity.departmentName = departmentName;
  }
  final List<dynamic>? dids = (json['dids'] as List<dynamic>?)?.map(
          (e) => e).toList();
  if (dids != null) {
    departmentUserEntity.dids = dids;
  }
  final String? education = jsonConvert.convert<String>(json['education']);
  if (education != null) {
    departmentUserEntity.education = education;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    departmentUserEntity.id = id;
  }
  final String? mobile = jsonConvert.convert<String>(json['mobile']);
  if (mobile != null) {
    departmentUserEntity.mobile = mobile;
  }
  final String? nickname = jsonConvert.convert<String>(json['nickname']);
  if (nickname != null) {
    departmentUserEntity.nickname = nickname;
  }
  final int? sex = jsonConvert.convert<int>(json['sex']);
  if (sex != null) {
    departmentUserEntity.sex = sex;
  }
  final String? username = jsonConvert.convert<String>(json['username']);
  if (username != null) {
    departmentUserEntity.username = username;
  }
  final bool? isSelected = jsonConvert.convert<bool>(json['isSelected']);
  if (isSelected != null) {
    departmentUserEntity.isSelected = isSelected;
  }
  return departmentUserEntity;
}

Map<String, dynamic> $DepartmentUserEntityToJson(DepartmentUserEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['companyCode'] = entity.companyCode;
  data['defaultStatus'] = entity.defaultStatus;
  data['departmentIds'] = entity.departmentIds;
  data['departmentName'] = entity.departmentName;
  data['dids'] = entity.dids;
  data['education'] = entity.education;
  data['id'] = entity.id;
  data['mobile'] = entity.mobile;
  data['nickname'] = entity.nickname;
  data['sex'] = entity.sex;
  data['username'] = entity.username;
  data['isSelected'] = entity.isSelected;
  return data;
}

extension DepartmentUserEntityExtension on DepartmentUserEntity {
  DepartmentUserEntity copyWith({
    String? companyCode,
    String? defaultStatus,
    String? departmentIds,
    String? departmentName,
    List<dynamic>? dids,
    String? education,
    String? id,
    String? mobile,
    String? nickname,
    int? sex,
    String? username,
    bool? isSelected,
  }) {
    return DepartmentUserEntity()
      ..companyCode = companyCode ?? this.companyCode
      ..defaultStatus = defaultStatus ?? this.defaultStatus
      ..departmentIds = departmentIds ?? this.departmentIds
      ..departmentName = departmentName ?? this.departmentName
      ..dids = dids ?? this.dids
      ..education = education ?? this.education
      ..id = id ?? this.id
      ..mobile = mobile ?? this.mobile
      ..nickname = nickname ?? this.nickname
      ..sex = sex ?? this.sex
      ..username = username ?? this.username
      ..isSelected = isSelected ?? this.isSelected;
  }
}